package com.ming.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ming.domain.SysLoginUser;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author:何元才
 * @Desc:
 * @data:2021-03-31 09:08
 */
public interface SysLoginUserMapper extends BaseMapper<SysLoginUser> {

    /**
     * 权限就查询完了
     *
     * @param userId
     * @return
     */
    @Select(" SELECT DISTINCT t1.perms FROM sys_menu as t1 join sys_role_menu as t2 on(t1.menu_id = t2.menu_id) join sys_user_role as t3 on(t2.role_id = t3.role_id) where t3.user_id = #{value} and (t1.type = 1 or t1.type = 2) ")
    List<String> findAuthById(Long userId);
}